package messages;

import game.MatchStatistics;
import game.Player;
import java.util.List;


/**
 * MatchEndedMessage
 * 
 * Message sent to everyone when a match ends. Includes match related
 * statistics and the list of players and updated rankings.
 */
public class MatchEndedMessage extends Message {

	public MatchEndedMessage(List<Player> players, MatchStatistics matchStatistics) {
		super();
		
		this.players = players;
		this.matchStatistics = matchStatistics;
	}
		
	
	public List<Player> getPlayers() {
		return this.players;
	}


	public MatchStatistics getMatchStatistics() {
		return this.matchStatistics;
	}
	
	public String toString() {
		String s = super.toString() + " MatchEnded (" + this.matchStatistics.getMatchId() + ") ";
		
		for (Player player : players) {
			s += "[" + player.getLogin() + " - " + player.getRanking() + "] ";
		}
		
		return s;
	}
	

	private MatchStatistics matchStatistics;	// Statistics about the match that ended.
	private List<Player> players;				// Players who participated in this match

	private static final long serialVersionUID = 1L;
}
